package com.xr.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.xr.constant.MessageConstant;
import com.xr.result.Result;
import com.xr.service.MemberService;
import com.xr.service.SetMealService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("report")
public class GetSetmealReport {


    @Reference
    private MemberService memberService;
    @Reference
    private SetMealService setMealService;

    @RequestMapping("/getSetmealReport")
    public Result getSetmealReport(){
        try{
            List<Map<String, Object>> list = setMealService.findSetmealCount();
            return new
                    Result(true, MessageConstant.GET_SETMEAL_COUNT_REPORT_SUCCESS,list);
        }catch (Exception e){
            e.printStackTrace();
        }
        return new Result(true,MessageConstant.GET_SETMEAL_COUNT_REPORT_FAIL);
    }

    @RequestMapping("/getBusinessReportData")
    public Result getBusinessReportData(){
        try {
            Map<String, Object> map = setMealService.getBusinessReportData();
            return new Result(true,MessageConstant.GET_BUSINESS_REPORT_SUCCESS,map);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(true,MessageConstant.GET_BUSINESS_REPORT_FAIL);
        }
    }
}
